clc,clear

%% sample variables along x-direction
x_position_start = 0;
x_position_end = 6.4;
y_position = 1;

fid = fopen('sample.txt','wt');

line_0_1 =  sprintf('sets\n');
line_0_2 =  sprintf('(\n');
line_0_3 =  sprintf('\n');
line_0 = [line_0_1, line_0_2, line_0_3];
fprintf(fid,'%s',line_0);

for i = 1:1:128
z_position = i / 128 * 3.2;
    
line_0_1 =  sprintf('    line_x_');
line_0_2 = sprintf(num2str(i));
line_0_3 =  sprintf('\n');
line_0=[line_0_1,line_0_2,line_0_3];
fprintf(fid,'%s',line_0);

line_1 = sprintf('    {\n');
fprintf(fid,'%s',line_1);

line_2 =  sprintf('        type    lineUniform;\n');
fprintf(fid,'%s',line_2);

line_3 =  sprintf('        axis    distance;\n');
fprintf(fid,'%s',line_3);

line_4_1 = sprintf('        start	(');
line_4_2 = sprintf(num2str(x_position_start));
line_4_3 = sprintf(' ');
line_4_4 = sprintf(num2str(y_position));
line_4_5 = sprintf(' ');
line_4_6 = sprintf(num2str(z_position));
line_4_7 = sprintf(')\n');
line_4=[line_4_1,line_4_2,line_4_3,line_4_4,line_4_5,line_4_6,line_4_7];
fprintf(fid,'%s',line_4);

line_5_1 = sprintf('        end  	(');
line_5_2 = sprintf(num2str(x_position_end));
line_5_3 = sprintf(' ');
line_5_4 = sprintf(num2str(y_position));
line_5_5 = sprintf(' ');
line_5_6 = sprintf(num2str(z_position));
line_5_7 = sprintf(')\n');
line_5=[line_5_1,line_5_2,line_5_3,line_5_4,line_5_5,line_5_6,line_5_7];
fprintf(fid,'%s',line_5);

line_6 =  sprintf('        nPoints 128;\n');
fprintf(fid,'%s',line_6);

line_7 =  sprintf('    }\n');
fprintf(fid,'%s',line_7);

end

line_0_1 =  sprintf('\n);\n');
line_0 = [line_0_1];
fprintf(fid,'%s',line_0_1);

fclose(fid);